/*
 * PriorityQ.h
 *
 *  Created on: 2013-11-12
 *      Author: all
 */

#ifndef PRIORITYQ_H_
#define PRIORITYQ_H_

#include "Process.h"
#include "FinishedQ.h"
#include <stdio.h>
#include <list>
#include <pthread.h>

class PriorityQ {

public:
	virtual ~PriorityQ();
	void add(Process* p);
	void addNew(Process* p);
	Process* pull();
	static PriorityQ* getInstance();
	void resetPriorityRuntime();

private:
	std::list<Process*> highPrio;
	std::list<Process*> medPrio;
	std::list<Process*> lowPrio;

	pthread_mutex_t mutex;
	pthread_cond_t hasProcesses;
	pthread_cond_t hasRoom;
	int processesRunning;

	static PriorityQ* instance;
	PriorityQ();
	FinishedQ* finished;
};

#endif /* PRIORITYQ_H_ */
